#include "VSModelSwitchNode.h"
#include "VSGraphicInclude.h"
using namespace VSEngine2;
IMPLEMENT_RTTI(VSModelSwitchNode,VSSwitchNode)
static bool gs_bStreamRegistered_VSModelSwitchNode= VSModelSwitchNode::RegisterMainFactory();
bool VSModelSwitchNode::ms_bRegisterMainFactory = false;
bool VSModelSwitchNode::RegisterMainFactory()
{
	if (!ms_bRegisterMainFactory)
	{ 
		VSMain::AddInitialFuntion(VSModelSwitchNode::InitialClassFactory); 
		ms_bRegisterMainFactory = true;
	} 
	return ms_bRegisterMainFactory;

}
bool VSModelSwitchNode::InitialClassFactory()
{
	ms_ClassFactory.AddElement(ms_Type.GetName(),FactoryFunc);

	return 1;
}
VSObject * VSModelSwitchNode::FactoryFunc()
{
	return VS_NEW VSModelSwitchNode;

}
VSModelSwitchNode::VSModelSwitchNode()
{

}
VSModelSwitchNode::~VSModelSwitchNode()
{

}
VSGeometryNode * VSModelSwitchNode::GetGeometryNode(unsigned int uiLodLevel)
{
	if (uiLodLevel >= m_pChild.GetNum())
	{
		return NULL;
	}
	else
	{
		VSGeometryNode * pGeometryNode = DynamicCast<VSGeometryNode>(m_pChild[uiLodLevel]);
		return pGeometryNode;
	}
}